<?php
namespace app\index\controller;
use think\Controller;
use think\request;
use think\Db;
use think\Log;
class Basewx extends Controller{
	public function _initialize(){
	    session("url",request()->url());
		if(!session('user_id')){
			$url="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx352362f198d9c56b&redirect_uri=http://www.wuye.zfbzhsq.com/index/basewxget/getuserinfo.html&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect";
			header("Location:".$url);
			exit;
		}
	}

	function getJson($url){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($ch);
        curl_close($ch);
        return json_decode($output, true);
    } 
	
}